import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import HomeNavigator, {BottomTabParamList} from '@/pages/home';
import FlatListDetail from '@/pages/flatListDetail';
import {type DataItem} from '@/store';
import {type FlatListItemProps} from '@/components/FlatListItem';

export type StackParamList = {
  HomeNavigator: undefined;
  FlatListDetail: Partial<DataItem> & Pick<FlatListItemProps, 'source'>;
};

export type AllNavigatorParamList = StackParamList & BottomTabParamList;

const Stack = createNativeStackNavigator<StackParamList>();

const RootNavigator = () => {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
          name="HomeNavigator"
          component={HomeNavigator}
          options={{
            headerShown: false,
          }}
        />
        <Stack.Screen
          name="FlatListDetail"
          component={FlatListDetail}
          options={{
            headerShown: false,
          }}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
};

export default RootNavigator;
